<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" CodeBehind="Photos.aspx.cs" Inherits="Impact.Web.Admin.Photos" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script type="text/javascript">
        function openUpload()
        {
            var url = "UploadPhoto.aspx?gid=" + ServerControls.galleries.val();
            window.open(url, 'Upload', 'toolbar=0,location=0,menubar=0,height=300,width=500');
        }
        
        function reload()
        {
            __doPostBack( "Bind" );
        }
    </script>

    <table class="AdminTable">
        <tr>
            <th>Photos:</th>
            <th class="NonHeader">
                Gallery: 
                <asp:DropDownList ID="galleries" AutoPostBack="true" OnSelectedIndexChanged="GalleryChanged" runat="server"></asp:DropDownList>&nbsp;&nbsp;
                <a href="EditGalleries.aspx">Edit</a>&nbsp;&nbsp;
                <a href="javascript:void(0);" onclick="openUpload();">Upload</a>
            </th>
        </tr>
        
        <tr>
            <td colspan="2" style="text-align: center;">
                <asp:DataList id="photoList" CssClass="DataList" runat="server"  RepeatColumns="4" GridLines="Both" ItemStyle-HorizontalAlign="Center"
                     cellpadding="20" cellspacing="0" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1" HorizontalAlign="Center"
                     VerticalAlign="Middle" OnItemCommand="PhotoList_ItemCommand">    
                  <ItemTemplate>
                    <div style="text-align: center;">
                        <%# GetHtmlImage( Container.DataItem ) %><br />
                        <%# Eval("Caption") %>
                    </div>
                    <div style="text-align: right;">
                        <asp:ImageButton ID="deleteButton" CommandName="delete" CommandArgument='<%# Eval("PhotoId") %>'
                            ImageUrl="images/red-x.png" runat="server" /></div>
                  </ItemTemplate>
                </asp:DataList>
            </td>
        </tr>
        
        
        <asp:Panel ID="noPhotosPanel" Visible="false" runat="server">
            <tr>
                <td colspan="2">There are no photos in this gallery.</td>
            </tr>
        </asp:Panel>
        
    </table>
        

</asp:Content>
